package ie.dcu.spca.view.category;

import java.util.List;
import java.util.Map;

import android.os.Bundle;

import ie.dcu.spca.Main;
import ie.dcu.spca.data.BasicDataManager;
import ie.dcu.spca.data.CategoryDataManager;
import ie.dcu.spca.model.Bean;
import ie.dcu.spca.view.DataList;

public class CategoryList extends DataList {

    private static CategoryDataManager categoryManager;

    @Override
    protected void afterOnCreateInvoke(Bundle savedInstanceState) {
        super.afterOnCreateInvoke(savedInstanceState);
        categoryManager = Main.dataManager.categoryDataManager();
    }

    @Override
    protected BasicDataManager getBeanDataManager() {
        return categoryManager;
    }

    @Override
    protected Class getCRUDDialog() {
        return CategoryCRUDDialog.class;
    }

    @Override
    protected List<Bean> getDataListForRefreshOnWindowHasFocus() {
        return (List) categoryManager.get();
    }

    @Override
    protected void setBundleBeforeStartCRUDDialogForUpdate(Bundle bundle,
            Map<String, Object> dataMap) {
        bundle.putString(BasicDataManager.NAME, (String) dataMap
                .get(BasicDataManager.NAME));
    }

}
